﻿Imports System.Windows.Controls

Public Class NavigationService

    Private Shared _rootLayoutViewModel As RootLayoutViewModel

    Public Sub New(rootLayoutViewModel As RootLayoutViewModel)
        _rootLayoutViewModel = rootLayoutViewModel
        'Call Navigate(_currentPage)
    End Sub

    Public Shared Sub Navigate(target As Page)
        _rootLayoutViewModel.NavigationUri = New Uri(String.Format("/VMDWebFrontend;component/View/{0}.xaml", target.GetType().Name), UriKind.Relative)
    End Sub

    Public Shared Sub Navigate(Of T As Page)()
        Console.WriteLine("Navigate to " & New Uri(String.Format("/VMDWebFrontend;component/View/{0}.xaml", GetType(T).Name), UriKind.Relative).ToString())
        _rootLayoutViewModel.NavigationUri = New Uri(String.Format("/VMDWebFrontend;component/View/{0}.xaml", GetType(T).Name), UriKind.Relative)
    End Sub

    Public Shared Sub Navigate(url As String)
        _rootLayoutViewModel.NavigationUri = New Uri(String.Format("/VMDWebFrontend;component{0}", url), UriKind.Relative)
    End Sub

    Public Shared Sub Navigate(uri As Uri)
        _rootLayoutViewModel.NavigationUri = uri
    End Sub

End Class
